package org.kumas.sgrpc.rpc;

import java.util.Collections;
import java.util.List;

import org.kumas.sgrpc.common.URL;
import org.kumas.sgrpc.common.extension.Adaptive;
import org.kumas.sgrpc.common.extension.SPI;

/**
 *
 * @author KumasZhang
 * @version 1.0
 * @since 2021-05-08 09:24
 */
@SPI("dubbo")
public interface Protocol {

    int getDefaultPort();

    @Adaptive
    <T> Exporter<T> export(Invoker<T> invoker) throws RpcException;

    @Adaptive
    <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException;

    void destroy();

    default List<ProtocolServer> getServers() {
        return Collections.emptyList();
    }
}
